\NeedsTeXFormat{LaTeX2e}

\ProvidesPackage{errprop}[2018/11/26 Package for displaying error propagation]

\RequirePackage{tikz}
\RequirePackage{physics}
\RequirePackage{etoolbox}

\newtoggle{@useTimesSign}
\togglefalse{@useTimesSign}


\DeclareOption{timesSign}{\global\toggletrue{@useTimesSign}}

\ProcessOptions\relax


% define internal command that will be used to “parse” the format
\newtoggle{@firstIt} % toggle used in the internal command
\def\@intErrProp#1(#2){
	\toggletrue{@firstIt}%
	%
	\foreach \var in {#2} {%
		\iftoggle{@firstIt}{\global\togglefalse{@firstIt}}{+} \abs{\frac{\partial #1}{\partial \var}} \iftoggle{@useTimesSign}{\cdot}{} \Delta \var%
	}%
}

% Define “normal” command that will be called by the user
\DeclareRobustCommand{\errProp}[1]{%
	\@intErrProp #1%
}